package com.allianz.webapps.secondController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.ibatis.annotations.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.allianz.webapps.common.CustomerContextHolder;
import com.allianz.webapps.https.interfaces.type001.pojo.User;
import com.allianz.webapps.service.AcceptingService;
import com.allianz.webapps.service.BeforeUnderwritingService;
import com.allianz.webapps.service.MyPolicyService;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * 
 * 我的保单柱状图
 * @author 刘建弋
 *  /pad_marketing/accept/allAccept.action
 * 2017年3月8日
 */
@Controller
@RequestMapping(value = "accept")
public class AcceptingController {
	
	@Autowired
	private AcceptingService acceptingService;

	@RequestMapping(value = "allAccept")
	@ResponseBody
	public Map<String, Object> allAccept(HttpSession session) throws Exception {
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
		User user=(User) session.getAttribute("username");
		try {
	    String u=user.getAgentId();
		long l = Long.parseLong(u);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("agentId", l);
		Map<String, Object> result = acceptingService.AllAccept(map);
		return result;
		} catch (Exception e) {
			throw new Exception("请检查您的网络");
		}
	
	}
}